package com.cs.study.homework._0302;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Scanner;

public class Demo3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try (FileOutputStream out = new FileOutputStream("E:\\a\\aa.txt")) {
            while (true) {
                String s = sc.nextLine();
                out.write(s.getBytes());
                if (s.equals("end")) {
                    out.close();
                    break;
                }
            }
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
